/*
 * Copyright 2012 Alibaba.com All right reserved. This software is the
 * confidential and proprietary information of Alibaba.com ("Confidential
 * Information"). You shall not disclose such Confidential Information and shall
 * use it only in accordance with the terms of the license agreement you entered
 * into with Alibaba.com.
 */
package jim.h.commons;

import java.io.IOException;
import java.net.URLDecoder;
import java.util.Map;

import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.ObjectMapper;

/**
 * @author jinggang.huangjg 2012-5-2 上午9:56:06
 */
public class OceanJson {

    private static final String PARAMS = "%7B%22requests%22%3A%5B%7B%22namespace%22%3A%22cn.alibaba.logistics%22%2C%22operation%22%3A%22update%22%2C%22parameters%22%3A%7B%22qmap%22%3A%7B%22params%22%3A%22%7B%5C%22logisticCompanyID%5C%22%3A%5C%22YUNDA%5C%22%2C%5C%22logisticID%5C%22%3A%5C%22AL09012420168%5C%22%2C%5C%22businessNetworkNo%5C%22%3A%5C%22201100%5C%22%2C%5C%22mailNo%5C%22%3A%5C%221200486852045%5C%22%2C%5C%22gmtUpdated%5C%22%3A1335920821000%2C%5C%22comments%5C%22%3A%5C%22%5C%22%2C%5C%22statusType%5C%22%3A%5C%22SIGNSUCCESS%5C%22%2C%5C%22sender%5C%22%3A%7B%5C%22companyName%5C%22%3A%5C%22%E5%8F%B6%E7%BE%BD%E7%BE%A4%5C%22%2C%5C%22name%5C%22%3A%5C%22%E5%B0%8F%E5%8F%B6%5C%22%2C%5C%22postCode%5C%22%3A%5C%22%5C%22%2C%5C%22phone%5C%22%3A%5C%22%5C%22%2C%5C%22mobile%5C%22%3A%5C%2215990254773%5C%22%2C%5C%22province%5C%22%3A%5C%22%E4%B8%8A%E6%B5%B7%5C%22%2C%5C%22city%5C%22%3A%5C%22%E4%B8%8A%E6%B5%B7%E5%B8%82%5C%22%2C%5C%22county%5C%22%3A%5C%22%E4%B8%8A%E6%B5%B7%E5%B8%82%5C%22%2C%5C%22address%5C%22%3A%5C%22%E4%B8%8A%E6%B5%B7%E4%B8%8A%E6%B5%B7%E5%B8%82%E4%B8%8A%E6%B5%B7%E5%B8%82%5C%22%7D%2C%5C%22receiver%5C%22%3A%7B%5C%22companyName%5C%22%3A%5C%22%E9%BB%84%E4%BB%8A%5C%22%2C%5C%22name%5C%22%3A%5C%22%E9%BB%84%E4%BB%8A%5C%22%2C%5C%22postCode%5C%22%3A%5C%22110000%5C%22%2C%5C%22phone%5C%22%3A%5C%22%5C%22%2C%5C%22mobile%5C%22%3A%5C%2215840431997%5C%22%2C%5C%22province%5C%22%3A%5C%22%E8%BE%BD%E5%AE%81%E7%9C%81%5C%22%2C%5C%22city%5C%22%3A%5C%22%E6%B2%88%E9%98%B3%E5%B8%82%5C%22%2C%5C%22county%5C%22%3A%5C%22%E6%B2%88%E9%98%B3%E5%B8%82%5C%22%2C%5C%22address%5C%22%3A%5C%22%E8%BE%BD%E5%AE%81%E7%9C%81%E6%B2%88%E9%98%B3%E5%B8%82%E6%B2%88%E9%98%B3%E5%B8%82%E6%B5%91%E5%8D%97%E6%96%B0%E5%8C%BA%20%E8%BE%BD%E5%AE%81%E7%9C%81%20%E6%B2%88%E9%98%B3%E5%B8%82%20%E6%B5%91%E5%8D%97%E6%96%B0%E5%8C%BA%09%E4%B8%B4%E6%B3%A2%E8%B7%AF15-11%E5%8F%B7141%E5%8F%B7%EF%BC%88%E4%BC%8A%E4%B8%BD%E4%BA%9A%E7%89%B9%E6%B9%BE%E4%BA%8C%E6%9C%9F%EF%BC%89%09110180%5C%22%7D%2C%5C%22cargoName%5C%22%3A%5C%22%E7%9C%BC%E9%9C%9C%E7%AD%89%5C%22%2C%5C%22totalWeight%5C%22%3A0.35%2C%5C%22totalVolume%5C%22%3A0%2C%5C%22totalNumber%5C%22%3A1%2C%5C%22payType%5C%22%3A%5C%220%5C%22%2C%5C%22transportPrice%5C%22%3Anull%2C%5C%22packageService%5C%22%3A%5C%22%5C%22%2C%5C%22packageServicePrice%5C%22%3Anull%2C%5C%22insuranceValue%5C%22%3Anull%2C%5C%22insurancePrice%5C%22%3Anull%2C%5C%22otherPrice%5C%22%3Anull%2C%5C%22totalPrice%5C%22%3A15.00%2C%5C%22remark%5C%22%3A%5C%221200486852045%20%2C%E5%8F%AF%E4%BB%A5%E5%9C%A8%E6%99%9A%E4%B8%8A10%E7%82%B9%E4%B9%8B%E5%90%8E%E6%9F%A5%E7%9C%8B%E7%89%A9%E6%B5%81%E8%B7%9F%E8%B8%AA%5C%22%7D%22%2C%22digest%22%3A%22ODIwZGRkOTM3YjgzYjhhNzNmN2U4N2JmZTY0NDFkNmI%3D%5Cr%5Cn%22%2C%22timestamp%22%3A%221335920821000%22%7D%7D%7D%5D%7D";

    public static void main(String[] args) throws JsonParseException, JsonMappingException, IOException {
        String json = URLDecoder.decode(PARAMS, "utf-8");
        System.out.println(json);
        Map obj = new ObjectMapper().readValue(json.replace("\t", "\\t"), Map.class);
        System.out.println(obj);
    }
}
